import { View } from "../../../../mvc/core/View";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { EPetArenaSearch } from "../../../../../Message/Game/EPetArenaSearch";
import { TimeButton } from "../../common/button/TimeButton";
import { Language } from "../../../../../extend/language/Language";
import { TilePanel } from "../../equipment/TilePanel";
import { PetCpnArrangeCellRenderer } from "./PetCpnArrangeCellRenderer";
import { PageSelecter } from "../../common/pageSelect/PageSelecter";
import { _EPetArenaSearchChallengeRank } from "../../../../../EPetArenaSearch/_EPetArenaSearchChallengeRank";
//class PetCpnRankListPanel
    
    export  class PetCpnRankListPanel extends View
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public updateList(arg1: Array<any>): void
        {
            this._arrangeList.dataProvider = new DataProvider(arg1);
            return;
        }

        public refreshList(): void
        {
            var loc1=1;
            Dispatcher.dispatchEvent(new DataEvent(EventName.PetCpnSearch, {"searchType": _EPetArenaSearchChallengeRank, "perPage": 10, "targetPage": loc1}));
            return;
        }

        /* internal  */init(): void
        {
            this._refreshButton = new TimeButton(10);
            this._refreshButton.styleName = "Button";
            this._refreshButton.label = Language.getString(54706);
            this._refreshButton.setSize(70, 24);
            this._refreshButton.move(460, -50);
            this._refreshButton.addEventListener(flash.events.MouseEvent.CLICK, this.onRefreshButtonClickHandler);
            this.addChild(this._refreshButton);
            this._arrangeList = new TilePanel();
            this._arrangeList.setSize(530, 350);
            this._arrangeList.columnWidth = 530;
            this._arrangeList.rowHeight = 32;
            this._arrangeList.setStyle("cellRenderer", PetCpnArrangeCellRenderer);
            this._arrangeList.move(0, 0);
            this.addChild(this._arrangeList);
            return;
        }

        /* internal  */onCurPageChangeHandler(arg1: Object /* flash.events.Event */): void
        {
            this.refreshList();
            return;
        }

        /* internal  */onRefreshButtonClickHandler(arg1: Object /* flash.events.Event */): void
        {
            this.refreshList();
            return;
        }

        /* internal */ /* var */_refreshButton: TimeButton;

        /* internal */ /* var */_arrangeList: TilePanel;

        /* internal */ /* var */_pageBar: PageSelecter;
    }
